import request from '@/utils/request'

export function getSubjectList(sid) {
  return request({
    url: '/p/pms/subject/cate/' + sid,
    method: 'get',
  })
}

export function fetchList(params) {
  return request({
    url: '/pms/book/list',
    method: 'get',
    params: params
  })
}

export function getSubjectAll() {
  return request({
    url: '/p/pms/subject/listAll',

    method: 'get',
  })
}

export function getFileList(ids) {
  return request({
    url: '/pms/book/file',
    method: 'post',
    data: {
      ids
    }
  })
}

export function getCategoryListAll() {
  return request({
    url: '/p/pms/bookCategory/listAll',
    method: 'get',
  })
}

export function fetchSimpleList(params) {
  return request({
    url: '/product/simpleList',
    method: 'get',
    params: params
  })
}

export function updateDeleteStatus(params) {
  return request({
    url: '/product/update/deleteStatus',
    method: 'post',
    params: params
  })
}

export function updateNewStatus(params) {
  return request({
    url: '/product/update/newStatus',
    method: 'post',
    params: params
  })
}

export function updateRecommendStatus(params) {
  return request({
    url: '/pms/book/recommend/update',
    method: 'get',
    params: params
  })
}

export function updatePublishStatus(params) {
  return request({
    url: '/pms/book/state/update',
    method: 'get',
    params: params
  })
}

export function createProduct(data) {
  return request({
    url: '/product/create',
    method: 'post',
    data: data
  })
}

export function updateProduct(id, data) {
  return request({
    url: '/product/update/' + id,
    method: 'post',
    data: data
  })
}

export function getProduct(id) {
  return request({
    url: '/product/updateInfo/' + id,
    method: 'get',
  })
}

export function updateBook(id, data) {
  return request({
    url: '/pms/book/update/' + id,
    method: 'post',
    contentType: "multipart/form-data",
    processData: false,
    data
  })
}

